angular.module('entrance', ['slide-banner'])

.controller 'EntranceCtrl', ($scope, $state,showToast, $http, $ionicHistory, $ionicViewSwitcher, $stateParams,$ionicSlideBoxDelegate,$ionicPopup) ->
    $http.get('/advertise/',params:{action:'startpage'})
    .success (resp) ->
        if resp?.status == '0'
            $scope.imgs = resp.body
            $ionicSlideBoxDelegate.$getByHandle('banner').update()
            $ionicSlideBoxDelegate.$getByHandle('banner').loop(true)
        else
            showToast resp.error
    .error ->
        showToast '服务器处理失败'

    _.extend $scope,
        goLogin: ->
            $state.go 'login'
        goRegister: ->
            $state.go 'register'

